#e
#Title[|uXoC`[-Normal-v]
#Text[]
#PlayLevel[Normal]
#ScriptVersion[2]

script_enemy_main {
 let name = "|uXoC`[-Normal-v";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetLife(5000);
  SetMovePosition02(GetCenterX, GetCenterY, startWait);
  SetTimer(50);
  SetScore(1005000);

  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(64, 0, 128, 64);

  TMain;
 }

 @MainLoop {
  SetCollisionA(GetX, GetY, 24);
  SetCollisionB(GetX, GetY, 8);

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

 task TMain {
  yield;

  wait(startWait);
  TShot;
 }

 task TShot {
  let kSpeed = 0.2;
  let kAngle = 0;
  let count = 0;
  let scope = 8.5;
  yield;

  loop {
   shotWait = 160;
   SetMovePositionRandom01(rand(0, 100), rand(0, 100), 1, GetClipMinX, GetClipMinY, GetClipMaxX, GetCenterY);

   kAngle = atan2(GetPlayerY - GetY, GetPlayerX - GetX) + scope;
   loop(20) {
    loop(5) {
     CreateShot01(GetX, GetY, kSpeed, kAngle, RED32, 0);
     CreateShot01(GetX, GetY, kSpeed - 0.05, kAngle - 1, PURPLE32, 0);
     kSpeed += 0.3;
    }
    kSpeed = 0.2;
    kAngle += (360 - scope * 2) / 20;
   }

   count += 1;
   if(count == 1) {
    HomingButterfly(1, shotWait * 7, 1);
   }
   if(count == 6) {
    count = 0;
   }

   wait(shotWait);
  }
 }

#include_function ".\CN[ht@C.txt"

}